/**
 * AluiCommons -  http://code.google.com/p/alui-toolbox/
 * Copyright (c) 2008-2009
 * by Fabien Sanglier
 * 
 * This file is part of AluiCommons.
 * 
 * AluiCommons is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * AluiCommons is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with AluiCommons.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

using System;
using System.Data;
using System.Configuration;
using com.plumtree.server;

namespace AluiServerLib.Business
{
    public abstract class BaseALUIObject : IPTObject
    {
        protected int objectid;
        protected string name;
        protected string description;

        public abstract void Inflate(IPTSession ptSession, bool lockObject);
        public abstract IPTObject GetInternal();

        #region IPTObject Overrides
        public void SetObjectID(int objid)
        {
            if (null != GetInternal())
            {
                GetInternal().SetObjectID(objid);
            }
            else
            {
                this.objectid = objid;
            }
        }

        public int GetObjectID()
        {
            if (null != GetInternal())
            {
                return GetInternal().GetObjectID();
            }
            else
            {
                return this.objectid;
            } 
        }

        public void SetName(string objname)
        {
            if (null != GetInternal())
            {
                GetInternal().SetName(objname);
            }
            else
            {
                this.name = objname;
            }    
        }

        public string GetName()
        {
            if (null != GetInternal())
            {
                return GetInternal().GetName();
            }
            else
            {
                return this.name;
            } 
        }

        public void SetDescription(string objdesc)
        {
            if (null != GetInternal())
            {
                GetInternal().SetDescription(objdesc);
            }
            else
            {
                this.description = objdesc;
            }
        }

        public string GetDescription()
        {
            if (null != GetInternal())
            {
                return GetInternal().GetDescription();
            }
            else
            {
                return this.description;
            }
        }
        #endregion

        #region IPTObject Members

        public int GetAdminFolderID()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public int GetClassID()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public com.plumtree.openfoundation.util.XPDateTime GetCreated()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public string GetImageUUID()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public com.plumtree.openfoundation.util.XPDateTime GetLastModified()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public IPTObjectProperties GetObjectProperties()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void SetAdminFolderID(int Value)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void SetImageUUID(string Value)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void SetLastModified(com.plumtree.openfoundation.util.XPDateTime Value)
        {
            GetInternal().SetLastModified(Value);
        }

        #endregion

        #region IPTLocalizable Members


        public bool GetIsLocalized()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public string GetLocalizedDescription()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public object[][] GetLocalizedDescriptions()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public string GetLocalizedName()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public object[][] GetLocalizedNames()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public string GetPrimaryLang()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public bool GetSupportsLocalization()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void SetIsLocalized(bool Value)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void SetLocalizedDescriptions(object[][] Value)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void SetLocalizedNames(object[][] Value)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void SetPrimaryLang(string Value)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        #endregion

        #region IPTUnknown Members

        public object GetInterfaces(string bstrInterface)
        {
            return GetInternal().GetInterfaces(bstrInterface);
        }

        #endregion

        #region IPTServerContext Members

        public IPTAccessList GetACL()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public int GetAccessLevel()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public int GetLastModifiedBy()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public int GetLockState()
        {
            return GetInternal().GetLockState();
        }

        public int GetOwnerID()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public int GetServerContextSettings(int iSetting)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public IPTSession GetSession()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public int GetSettings(int iSetting)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public bool LockObject()
        {
            return GetInternal().LockObject();
        }

        public void SetLastModifiedBy(int iUser)
        {
            GetInternal().SetLastModifiedBy(iUser);
        }

        public void SetOwnerID(int iOwnerID)
        {
            GetInternal().SetOwnerID(iOwnerID);
        }

        public void SetServerContextSettings(int iSetting, int iValue)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void SetSettings(int iSetting, int iValue)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void UnlockObject()
        {
            GetInternal().UnlockObject();
        }

        #endregion

        #region IPTStorable Members

        public void Store()
        {
            GetInternal().Store();
        }

        #endregion
    }
}
